package com.goodjia.phase1module3;

public class Student {

    // 私有成员变量name、age
    private String name;
    private int age;

    // 有参构造函数
    public Student(String name, int age) {
        setName(name);
        setAge(age);
    }

    public Student() {
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 重写toString方法打印时会按拼接的字符串结果返回
     * @return
     */
    @Override
    public String toString() {
        return "Student{" +
            "name='" + name + '\'' +
            ", age=" + age +
            '}';
    }

}
